json.result   true
json.message  "获取商品列表成功"
json.data @spus do |spu|
  json.id                     spu.id
  json.name                   spu.name
  json.sales_volume           spu.sales_volume
  json.avatar                 spu.avatar.url("50percent")
  json.description            spu.description
  json.published              spu.published
  json.promotion              spu.promotion
  json.seven_day_back         spu.seven_day_back
  json.genuine_product        spu.genuine_product
  json.low_promotion_price    "#{@current_user.blank? ? spu.protect_low_promotion_price : @current_user.computed_price(spu.low_promotion_price)}"
  json.high_promotion_price   "#{@current_user.blank? ? spu.protect_high_promotion_price : @current_user.computed_price(spu.high_promotion_price)}"
  json.low_sale_price         "#{@current_user.blank? ? spu.protect_low_sale_price : @current_user.computed_price(spu.low_sale_price)}"
  json.high_sale_price        "#{@current_user.blank? ? spu.protect_high_sale_price : @current_user.computed_price(spu.high_sale_price)}"
  json.low_cost_price         "#{@current_user.blank? ? spu.protect_low_cost_price : @current_user.computed_price(spu.low_cost_price)}"
  json.high_cost_price        "#{@current_user.blank? ? spu.protect_high_cost_price : @current_user.computed_price(spu.high_cost_price)}"
  json.can_use_coupon         spu.can_use_coupon
  json.favorited              @current_user.presence ? spu.is_favorited?(@current_user.id) : false
  json.stock                  spu.stock
  json.express_fee            "#{spu.default_express_fee}"
  json.direct_sale            spu.shop.direct_sale
  json.shop_category          do
    json.id                   spu.shop_category.id
    json.name                 spu.shop_category.name
  end
  if spu.brand.presence
    json.brand       do
      json.id                spu.brand.id
      json.name              spu.brand.name
      json.avatar            spu.brand.avatar.url
      json.big_avatar        spu.brand.big_avatar.url
    end
  end
  json.pictures         spu.spu_images do |spu_image|
    json.id             spu_image.id
    json.url            spu_image.image.url("50percent")
  end
  json.parameters       spu.spu_parameters do |spu_parameter|
    json.key              spu_parameter.param_key
    json.value            spu_parameter.param_value
  end
  json.details          spu.spu_details do |spu_detail|
    json.url              spu_detail.image.url("50percent")
  end
  json.service_items    spu.service_items do |service_item|
    json.avatar           service_item.avatar.url("50percent")
    json.name             service_item.name
    json.description      service_item.description
  end
  json.skus             spu.skus do |sku|
    json.id               sku.id
    json.name             sku.name
    json.cost_price       "#{sku.cost_price}"
    json.sale_price       "#{sku.sale_price}"
    json.promotion_price  "#{sku.promotion_price}"
    json.on_hand_count    sku.on_hand_count
    json.option_values    sku.option_values do |option_value|
      json.presentation      option_value.presentation
      json.name              option_value.name
    end
    json.avatar           sku.avatar.url("50percent")
  end
end